﻿using UnityEngine;
using System.Collections.Generic;
using System.Reflection;
using System.IO;

#if UNITY_EDITOR
using UnityEditor;
#endif

namespace ProjectTW.Foliage
{
    public class UNSettings : ScriptableObject
    {
        public const string ProjectVersion = "2.2";
        public const string fileName = "UNSetting";
        public const string ProjectName = "Foliage";

        public bool ThreadingEnabled = true;
        public ThreadWorkers ThreadingWorkersCount = ThreadWorkers.OneWorker;
        public bool LogDebuggingEnabled = false;
        public bool FoliageDisableCulling = false;

        private static UNSettings s_Instance;

        public static string ProjectPath
        {
            get
            {
                return string.Format("Assets/{0}/", ProjectName);
            }
        }

        public static UNSettings Instance
        {
            get
            {
                if (s_Instance == null)
                {
                    s_Instance = Resources.Load<UNSettings>(fileName);
                }

                return s_Instance;
            }
        }

        public static void Log(string context)
        {
            if (Instance.LogDebuggingEnabled)
            {
                Debug.Log("<b>uNature Debug Mode : " + context + "</b>");
            }
        }
    }
}
